(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            aRoomDetailHisOwnerInfo: {
                owners: [],
                ownerId: '',
                roomId: ''
            }
        },
        _initMethod: function () {
        },
        _initEvent: function () {
            //切换 至费用页面
            vc.on('aRoomDetailHisOwner', 'switch', function (_param) {
                if (_param.roomId == '') {
                    return
                }
                $that.clearARoomDetailHisOwnerInfo();
                vc.copyObject(_param, $that.aRoomDetailHisOwnerInfo)
                $that._listARoomDetailHisOwner(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('aRoomDetailHisOwner', 'listMachineTranslate', function () {
                $that._listARoomDetailHisOwner(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('aRoomDetailHisOwner', 'paginationPlus', 'page_event',
                function (_currentPage) {
                    $that._listARoomDetailHisOwner(_currentPage, DEFAULT_ROWS);
                }
            );
        },
        methods: {
            _listARoomDetailHisOwner: function (_page, _row) {
                let param = {
                    params: {
                        page: _page,
                        row: _row,
                        roomId: $that.aRoomDetailHisOwnerInfo.roomId
                    }
                }
                //发送get请求
                vc.http.apiGet('/owner.queryAdminRoomHisOwner',
                    param,
                    function (json, res) {
                        let _json = JSON.parse(json);
                        $that.aRoomDetailHisOwnerInfo.total = _json.total;
                        $that.aRoomDetailHisOwnerInfo.records = _json.records;
                        $that.aRoomDetailHisOwnerInfo.owners = _json.data;
                        vc.emit('aRoomDetailHisOwner', 'paginationPlus', 'init', {
                            total: $that.aRoomDetailHisOwnerInfo.records,
                            dataCount: $that.aRoomDetailHisOwnerInfo.total,
                            currentPage: _page
                        });
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            _openShopsOwnerFee: function (_owner) {
                //vc.emit('editMachineTranslate', 'openEditMachineTranslateModal', _owner);
                vc.jumpToPage('/#/pages/property/listRoomFee?roomId=' +
                    _owner.roomId +
                    "&ownerId=" + _owner.ownerId +
                    "&hireOwnerFee=1")
            },
            clearARoomDetailHisOwnerInfo: function () {
                $that.aRoomDetailHisOwnerInfo = {
                    owners: [],
                    ownerId: '',
                    roomId: ''
                }
            }
        }
    });
})(window.vc);